package com.sw.bbs.user.controller;

import com.sw.bbs.common.common.GlobalException;
import com.sw.bbs.user.dao.ReportMapper;
import com.sw.bbs.user.pojo.Report;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Desc:
 * 1.举报
 * 2.
 * @Author: wusonghe
 * @Date: 2019/4/1 14:06
 */

//@Api(value = "管理员接口模块",description = "管理员接口", tags = {"Admin Module"})
//@RequestMapping("/admin/")
//@RestController
@Slf4j
public class AdminController {

    @Autowired
    private ReportMapper reportMapper;

    @GetMapping("/reports")
    @ApiOperation(value = "举报列表接口",response = ResponseEntity.class)
    @ApiResponses({@ApiResponse(code = 201, message = "举报列表", response = ResponseEntity.class)})
    public ResponseEntity<?> reports()
            throws GlobalException {
        try {
            List<Report> result = reportMapper.queryList();
            return new ResponseEntity<>(result, HttpStatus.OK);
        } catch (Exception e) {
            log.error("reports", e);
            throw new GlobalException("/common/reports", e.getMessage());
        }
    }

    @PostMapping("/operaUser")
    @ApiOperation(value = "操作用户接口" ,notes = "扣分加分",response = ResponseEntity.class)
    @ApiResponses({@ApiResponse(code = 201, message = "举报列表", response = ResponseEntity.class)})
    public ResponseEntity<?> operaUser()
            throws GlobalException {
        try {
            Integer result = null;//reportMapper.queryList();
            return new ResponseEntity<>(result, HttpStatus.OK);
        } catch (Exception e) {
            log.error("reports", e);
            throw new GlobalException("/common/reports", e.getMessage());
        }
    }
}
